1. Field of the Invention
The present invention relates to encoding and decoding of moving images, and particularly to a method for direct mode encoding and decoding of moving images.
2. Description of the Related Art
According to international standards for video compression, such as Motion Picture Experts Group (MPEP) MPEG-1, MPEG-2 and MPEG-4 standards defined by International Organization for Standardization/International Electrotechnical Commission (ISOIIEC) Joint Technical Committee 1 (JTC1) and H.26x standard by International Telecommunication Union-Telecom (ITU-T), there are a P-picture encoding method which refers to a past picture and a B-picture encoding method which refers to both a past picture and a future picture when predicatively encoding the movement of a current picture. Also, in order to increase coding efficiency, predictive coding is performed. Such predictive coding requires not only encoding a motion vector of a current block, but also using a motion vector of a neighboring block to reflect temporal and spatial connections to the motion vector of the neighboring block.
Therefore, in order to improve the coding efficiency of images, the precision of the motion vector and the resultant minimization of the motion prediction errors are important, and also the compression efficiency of motion vector data needs to be considered.
One example of the known methods that considers the compression efficiency of the motion vector data is a direct mode encoding method, which is largely divided into a temporal direct mode and a spatial direct mode. The temporal direct mode encoding method includes scaling a motion vector of the same position block of a backward reference picture temporally placed prior to a current picture and deriving a bidirectional motion vector of the corresponding block of the current picture from the motion vector of a backward reference picture if the motion vector of a backward reference picture points to a forward reference picture placed opposite the backward reference picture with respect to the current picture. The spatial direct mode encoding method includes obtaining a motion vector of blocks spatially close to a block to be encoded in the current picture and deriving a bidirectional motion vector from the obtained motion vector. The above two direct mode encoding methods show considerably higher coding efficiency because they do not require the transmission of a motion vector to a decoder. Hereinafter, the prior art direct mode encoding method will be described in detail.
FIG. 1 is a diagram for describing a temporal direct mode encoding method in encoding general moving images. Referring to FIG. 1, the prior art temporal direct mode encoding method includes obtaining a motion vector from the same position block of a backward reference picture and deriving a bidirectional motion vector by equally scaling the obtained motion vector with respect to temporal distance. Herein, the scaling is performed using Equations (1) and Equation (2).
                              mvFw          B                =                                            TD              B                                      TD              P                                ×                      mvFw            P                                              (        1        )                                          mvBw          B                =                              -                                                            TD                  P                                -                                  TD                  B                                                            TD                P                                              ×                      mvFw            P                                              (        2        )            
In Equations (1) and (2), TDP denotes a temporal distance from a forward reference picture to the backward reference picture. TDB denotes a temporal distance from a current picture to a forward reference picture. The mvFwP is a motion vector of the same position block of the backward reference picture, and this motion vector points to the forward reference picture which is located in the opposite direction of the backward with respect to the current picture. The computation result from Equation (1), mvFwB is a forward motion vector with respect to a block of the current picture.
In Equation (2), variables TDP, TDB and mvFw have the same meaning as those of Equation (1). The computation result from Equation (2), mvBwB is a motion vector in which a block of the current picture points to a backward reference picture.
In the temporal direct mode encoding method using Equations (1) and (2), if temporal correlation of images is greater than their spatial correlation, the coding efficiency becomes lower. Also, if the same position block of the backward reference picture is encoded as an intra block, which has no motion vector, such encoding is inefficient when calculating a direct mode motion vector.
FIG. 2 is a diagram for describing a spatial direct mode encoding method in encoding general moving images. Referring to FIG. 2, the prior art spatial direct mode encoding method makes use of spatial motion vector correlation of neighboring blocks, rather than temporal motion vector correlation. This method includes obtaining a motion vector from the spatially neighboring blocks with respect to a block of the current picture and deriving a bidirectional motion vector for the current block, using Equations (3) and (4).mvFwB=median(AFw,BFw,CFw)  (3)mvBwB=median(ABw,BBw,CBw)  (4)
In Equation (3), the variables AFw, BFw, and CFw are forward motion vectors of blocks with their encoding ended, and refer to forward motion vectors of blocks spatially adjacent to a block to be encoded. Referring again to FIG. 2, AFw forward motion vector is placed on the left side of the current block with respect to a spatial axis, BFw forward motion vector is placed on the upper side of the current block, and CFw forward motion vector is placed on the upper right side of the current block. Also, the median refers to the middle value function, and this function generally outputs the central value of input values which are sorted in an ascending order or in a descending order. The computation result from Equation (3) is a forward motion vector (mvFwB) for a block of the current picture.
In Equation (4), the variables ABw, BBw, and CBw are backward motion vectors of blocks with their encoding ended, and refer to backward motion vectors of blocks spatially adjacent to a block to be encoded. Herein, ABw backward motion vector is placed on the left side of the current block with respect to a spatial axis, BBw backward motion vector is placed on the upper side of the current block, and CBw backward motion vector is placed on the upper right side of the current block. The median performs such a function as described in Equation (3). The computation result from Equation (4) is a backward motion vector (mvBwB) for a block of the current picture.
The described temporal or spatial direct mode encoding method can predict the motion of images according to their attributes through using the characteristics of temporal and spatial correlations. Therefore, the number of the bits of the motion vector can be considerably reduced by encoding only the residual value of a block and block information, without encoding of the very motion vector.
As described above, the prior art direct mode encoding methods using temporal correlation and spatial correlation can effectively reduce the number of bits in bidirectional prediction since there is no need to transmit a motion vector. However, if a distance between the current picture and the backward reference picture increases with respect to the temporal axis, the prediction capability by deriving a motion vector decreases. Also, even if the corresponding block of the backward reference picture is encoded as an intra block, a motion vector of the direct mode is calculated just by considering it as a (0, 0) motion vector. In addition, if the motion characteristic of images between a forward reference picture and a backward reference picture is not primarily defined by the backward reference vector, a residue value increases and thus coding efficiency significantly decreases because a motion vector having a lower correlation is used.